package com.learn.recursive;

import java.util.List;

/**
 * 打印是否串所有子序列
 */
public class printAllStr {
    public void printAllSubStr(char[] chars, int index, List<String> ans, String path) {

        if (index == chars.length) {
            //当前索引来到终止位置，保存答案
            ans.add(path);
            return;
        }

        String no = path;
        //不要当前的字符
        printAllSubStr(chars, index + 1, ans, no);
        String yes = path + String.valueOf(chars[index]);
        //要当前的字符
        printAllSubStr(chars, index + 1, ans, yes);
    }
}
